//
//  NSString+Extension.m
//  dealData
//
//  Created by  Mac on 2021/3/25.
//

#import "NSString+Extension.h"

static inline BOOL ObjectIsNull(id object)
{
    BOOL isNull = NO;
    if (object == nil || object == NULL || object == [NSNull null])
    {
        isNull = YES;
    }
    return isNull;
}

@implementation  NSObject (Extension)

+(BOOL)isNullObject:(NSObject *)object{
    return ObjectIsNull(object);
}

@end

@implementation NSString (Extension)
-(BOOL)isNotBlankString{
    if (self == (id)[NSNull null]) {
        return NO;
    }
    NSCharacterSet * set = [NSCharacterSet whitespaceAndNewlineCharacterSet];
    return [self stringByTrimmingCharactersInSet:set].length!=0;
    
}
- (NSString *(^)(id obj))appending
{
    return ^(id obj){
        if (ObjectIsNull(obj)) {
            obj = @"";
        }
        return [NSString stringWithFormat:@"%@%@",self,obj];
    };
}
@end
